//
// U3dMouseListener.java
// Copyright (C) 2010  "Naush" <naush _ hotmail _ fr>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>./* ----------------------------------------------------------------------------







package org.ryzom.nel.threed;

import org.ryzom.nel.misc.CVector;

public class U3dMouseListener {
  private long swigCPtr;
  protected boolean swigCMemOwn;

  public U3dMouseListener(long cPtr, boolean cMemoryOwn) {
    swigCMemOwn = cMemoryOwn;
    swigCPtr = cPtr;
  }

  public static long getCPtr(U3dMouseListener obj) {
    return (obj == null) ? 0 : obj.swigCPtr;
  }

  protected void finalize() {
    delete();
  }

  public synchronized void delete() {
    if (swigCPtr != 0) {
      if (swigCMemOwn) {
        swigCMemOwn = false;
        nel3dJNI.delete_U3dMouseListener(swigCPtr);
      }
      swigCPtr = 0;
    }
  }

  public void setMatrix(SWIGTYPE_p_NLMISC__CMatrix matrix) {
    nel3dJNI.U3dMouseListener_setMatrix(swigCPtr, this, SWIGTYPE_p_NLMISC__CMatrix.getCPtr(matrix));
  }

  public void setFrustrum(CFrustum frustrum) {
    nel3dJNI.U3dMouseListener_setFrustrum(swigCPtr, this, CFrustum.getCPtr(frustrum), frustrum);
  }

  public void setViewport(CViewport viewport) {
    nel3dJNI.U3dMouseListener_setViewport(swigCPtr, this, CViewport.getCPtr(viewport), viewport);
  }

  public void setHotSpot(CVector hotSpot) {
    nel3dJNI.U3dMouseListener_setHotSpot(swigCPtr, this, CVector.getCPtr(hotSpot), hotSpot);
  }

  public void setMouseMode(U3dMouseListener.TMouseMode mouseMode) {
    nel3dJNI.U3dMouseListener_setMouseMode(swigCPtr, this, mouseMode.swigValue());
  }

  public void setSpeed(float speed) {
    nel3dJNI.U3dMouseListener_setSpeed(swigCPtr, this, speed);
  }

  public SWIGTYPE_p_NLMISC__CMatrix getViewMatrix() {
    return new SWIGTYPE_p_NLMISC__CMatrix(nel3dJNI.U3dMouseListener_getViewMatrix(swigCPtr, this), false);
  }

  public CVector getHotSpot() {
    return new CVector(nel3dJNI.U3dMouseListener_getHotSpot(swigCPtr, this), true);
  }

  public SWIGTYPE_p_NLMISC__IEventListener getEventListenerInterface() {
    return new SWIGTYPE_p_NLMISC__IEventListener(nel3dJNI.U3dMouseListener_getEventListenerInterface(swigCPtr, this), false);
  }

  public final static class TMouseMode {
    public final static TMouseMode nelStyle = new TMouseMode("nelStyle");
    public final static TMouseMode edit3d = new TMouseMode("edit3d");
    public final static TMouseMode firstPerson = new TMouseMode("firstPerson");

    public final int swigValue() {
      return swigValue;
    }

    public String toString() {
      return swigName;
    }

    public static TMouseMode swigToEnum(int swigValue) {
      if (swigValue < swigValues.length && swigValue >= 0 && swigValues[swigValue].swigValue == swigValue)
        return swigValues[swigValue];
      for (int i = 0; i < swigValues.length; i++)
        if (swigValues[i].swigValue == swigValue)
          return swigValues[i];
      throw new IllegalArgumentException("No enum " + TMouseMode.class + " with value " + swigValue);
    }

    private TMouseMode(String swigName) {
      this.swigName = swigName;
      this.swigValue = swigNext++;
    }

    private TMouseMode(String swigName, int swigValue) {
      this.swigName = swigName;
      this.swigValue = swigValue;
      swigNext = swigValue+1;
    }

    private TMouseMode(String swigName, TMouseMode swigEnum) {
      this.swigName = swigName;
      this.swigValue = swigEnum.swigValue;
      swigNext = this.swigValue+1;
    }

    private static TMouseMode[] swigValues = { nelStyle, edit3d, firstPerson };
    private static int swigNext = 0;
    private final int swigValue;
    private final String swigName;
  }

}
